Skip to content

Update sqlglot to support 27.0.0 or later #4227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025
Merged

Update sqlglot to support 27.0.0 or later #4227

merged 1 commit into from
Jul 16, 2025

Conversation

asnare
Copy link
Contributor

@asnare asnare commented Jul 16, 2025

Changes

This PR updates the sqlglot requirement to allow the 27.0.0 release. This release includes support for placeholders in SQL, a relatively new syntax feature supported in DBR 15.2 (or Apache Spark 4.0).

SQL queries can be of the form:

SELECT 1 AS col1, 2 AS col2, 3 AS col3 FROM {sdf_system_columns} LIMIT 5

…where sdf_system_columns is passed as a keyword argument, for example:

sdf_system_columns = spark.read.table("system.information_schema.columns")
sdf_example = spark.sql("SELECT 1 AS col1, 2 AS col2, 3 AS col3 FROM {sdf_system_columns} LIMIT 5",
                        sdf_system_columns = sdf_system_columns)

Older versions of sqlgplot would fail on this with a parsing error, but now it's parsed correctly but returns a Placeholder AST node as the name of the table instead of a string. Given the complexity of handling this properly, for now I've chosen to preserve the old behaviour: the linter will mark the query as unsupported. (See es-1285042.py for an example of this.)

Linked issues

Closes #4203

Tests

  • existing integration tests
  • existing (+ 1 updated) unit tests

@asnare asnare self-assigned this Jul 16, 2025
@asnare asnare requested a review from a team as a code owner July 16, 2025 17:09
@asnare asnare added migrate/code Abstract Syntax Trees and other dark magic internal this pull request won't appear in release notes dependencies Pull requests that update a dependency file labels Jul 16, 2025
@asnare asnare added this to UCX Jul 16, 2025
@asnare asnare temporarily deployed to account-admin July 16, 2025 17:09 — with GitHub Actions Inactive
@asnare asnare moved this to Ready for Review in UCX Jul 16, 2025
@asnare asnare enabled auto-merge July 16, 2025 17:18
Copy link

✅ 53/53 passed, 5 skipped, 1h15m17s total

Running from acceptance #8710

@asnare asnare added this pull request to the merge queue Jul 16, 2025
Merged via the queue into main with commit 06d5504 Jul 16, 2025
8 checks passed
@asnare asnare deleted the upgrade-sqlglot branch July 16, 2025 17:24
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in UCX Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file internal this pull request won't appear in release notes migrate/code Abstract Syntax Trees and other dark magic
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants